<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>注册_{$webname}</title>
<meta name='keywords'    content='{$keywords}'>
<meta name='description' content='{$description}'>
<!--公共样式开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/reset.css" />
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/common.css" />
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/FontAwesome/css/font-awesome.min.css" />
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/FontAwesome/css/font-awesome-ie7.min.css" />
<![endif]-->
<!--公共样式结束-->
<!--页面样式开始-->
<link href="__PUBLIC__/Plugins/Validform/css/validform.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/page_login.css" />
<!--页面样式结束-->
<script type="text/javascript" src="{$NOW_THEME_URL}/Assets/Js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="{$NOW_THEME_URL}/Assets/Js/jquery.SuperSlide.2.1.1.js"></script>
</head>

<body>
<div class="zhezhao"></div>
<div class="zz">
	<!--top start-->
	<include file="Public:header" lang="true" />
	<!--top end-->
	<!--content start-->
	<div class="content">
		<form class="formTable">
			<table class="lotab">
				<tbody>
				<tr>
					<th>&nbsp;</th>
					<td colspan="2"><div id="Validform_errortip_div"></div></td>
				</tr>
				<tr>
					<th><label for="myem" name="mobile">邮箱：</label></th>
					<td colspan='2'>
						<input type="text" name="username" id="username" class="myinput" placeholder="请输入您的电子邮箱" datatype="e" nullmsg="请输入您的电子邮箱" errormsg="电子邮箱输入错误" 
						ajaxurl="index.php?s=Public/checkMobile"/>
					</td>
				</tr>
				<!-- <tr>
					<th><label for="mypw">随机码：</label></th>
					<td colspan="2">
						<input type="text" name="code" class="myinput" placeholder="请输入您邮箱接收到的随机码" datatype="*4-4" nullmsg="请输入您邮箱接收到的随机码" errormsg="请输入您邮箱接收到的4位数随机码" />
					</td>
				</tr>-->		
				<tr>
					<th><label for="mypw">手机号码：</label></th>
					<td colspan="2">
						<input type="text" value="" name="mobile" class="myinput"
						placeholder="请输入手机号码" />
					</td>
				</tr>			
				<tr>
					<th><label for="mypw">密码：</label></th>
					<td colspan="2">
						<input type="password" value="" name="password" class="myinput"
						placeholder="请输入密码,长度为6-12位" datatype="*6-12" nullmsg="请输入密码,长度为6-12位" errormsg="请输入密码,长度为6-12位" />
					</td>
				</tr>
				<tr>
					<th><label for="mypw">确认密码：</label></th>
					<td colspan="2">
						<input type="password" value="" name="repassword" class="myinput"
						placeholder="请再次输入密码" datatype="*6-12" recheck="password" nullmsg="请再次输入密码" errormsg="确认密码输入格式不正确" />
					</td>
				</tr>
				<tr>
					<th><label for="mypw">验证码：</label></th>
					<td colspan="2">
						<input type="text" value="" name="yzm" class="myinput yzminput" 
						datatype="*2-4" nullmsg="请输入验证码" errormsg="验证码输入格式不正确" />
						<span class="yzm_img" 
						onClick="$('#yzmImg').attr('src','{:U("Public/verify")}&'+Math.random(1));">
							<img id="yzmImg" src="{:U('Public/verify')}" title="验证码不区分大小写"/>
							<a style="cursor:pointer">看不清楚? 换一张</a>
						</span>
					</td>
				</tr>
				<tr>
					<th></th>
					<td colspan="2">
						<input type="button" value="注册" class="btn_login" id="form_ele_submit" />
						<input type="reset"  value="重置" class="btn_login reset" />
					</td>
				</tr>
				</tbody>
			</table>
		</form>
	</div>
	<!--content end-->
	
	<!--footer start-->
	<include file="Public:footer" lang="true" />
	<!--footer end-->
	<!--online start-->
		<!--<div class="online">
			<span class="rlico"></span>
			<ul>
				<li class="xf1"><a href=""><img src="{$NOW_THEME_URL}/Assets/Images/xf1.png" /><p>Phone</p></a></li>
				<li class="xf2"><a href=""><img src="{$NOW_THEME_URL}/Assets/Images/xf2.png" /><p>Meal</p></a></li>
				<li class="xf3"><a href=""><img src="{$NOW_THEME_URL}/Assets/Images/xf3.png" /><p>My menu</p></a></li>
				<li class="xf4"><a href=""><img src="{$NOW_THEME_URL}/Assets/Images/xf4.png" /><p>Site Map</p></a></li>
				<li class="xf5"><a href="#top" id="backtop" ><img src="{$NOW_THEME_URL}/Assets/Images/xf5.png" /><p>Top</p></a></li>
			</ul>
		</div>
	online end-->
</div>
<script src="__PUBLIC__/Plugins/Validform/validform.min.js" ></script>
<script type="text/javascript">

$(function(){
	var flag = true ;  //定义全局变量
	var msg  = "" ;    //定义全局变量
	$(".formTable").Validform({tiptype:function(msg,o,cssctl){
		var objtip=$("#Validform_errortip_div");cssctl(objtip,o.type);objtip.text(msg);}
		,tipmsg:{
				tit:"Prompt information",
				w:"Please input the correct information！",
				r:"信息验证通过！",
				c:"Checking information…",
				s:"Please fill in the information！",
				v:"The filled information has not been verified, please try later…",
				p:"Data are presented…",
				err:"Wrong! To address or return data format is wrong！",
				abort:"Ajax operation was canceled！"
		},
	});
	
	//提交
	$('#form_ele_submit').on('click',function(){
		var postData = {};
		postData = $(".formTable").serialize();
		if(flag){
			$.post("{:U('Public/reg')}", postData , function(data){
				if(data.status==1){
					$("#Validform_errortip_div").html(data.data);
					//alert("注册成功,请登录！");window.location.href="index.php?s=Public/login"
					alert("注册成功");window.location.href="index.php?s=Index/my_address";
				}else{
					tip();
					$("#Validform_errortip_div").html(data.info);
				}
			}, "json");
		}else{
			tip();
			$("#Validform_errortip_div").html(msg); ;
		}	
	});
	
	//悬浮框显示隐藏
	$('.online').on('hover',function(){
		$('.online ul').toggle();
	});
	
	$('.sms_btn').on("click",function(){
		var obj = $(this);
		var mobile = $('#username').val();
		if(mobile){
			$.get('{:U("Public/sendSms")}',{mobile:mobile},function(data){
				if(data.status == 1){
					time(obj);
					alert("短信发送成功!");
				}else{
					alert("短信发送失败，请稍后重试");
				}
			});
		}else{
			$('#username').focus();
			alert("请输入您的手机号码");return;
		}
	});
});

var wait=60;
function time(o){
	if (wait == 0) {
		o.removeAttr("disabled");
		o.val("点击免费获取随机码");
		o.addClass("jym");
 		o.removeClass("jymnone");
		wait = 60;		
	} else {
		o.attr("disabled", true);			
		o.val("resend (" + wait + ")");	
		o.addClass("jymnone");
		o.removeClass("jym");		
		wait--;			
		setTimeout(function() {time(o)},1000)
	}	
}

function tip(){
	$("#Validform_errortip_div").removeClass('Validform_right');
	$("#Validform_errortip_div").addClass('Validform_wrong');
} 
</script>
</body>
</html>
